package com.luojiang.clinic.controller;

import com.luojiang.stockapi.api.StockApiService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @ClassName ClinicController
 * @Description
 * @Author luojiang
 * @Date 2021/1/27 16:50
 */
@RestController
public class ClinicController {

    @Reference
    StockApiService stockApiService;

    @GetMapping("/get")
    public String test(){
        return "success";
    }

    /**
     *功能描述 rpc调用
     * @author luo jiang
     * @date 2021/1/28
     * @param
     * @return java.lang.String
     */
    @GetMapping("/getByStock")
    public String getByStock(){
        return stockApiService.stockApi();
    }

    /**
     *功能描述 post请求测试
     * @author luo jiang
     * @date 2021/1/28
     * @param
     * @return java.lang.String
     */
    @PostMapping("/post")
    public String post(@RequestBody Map<String, Object> map){
        System.out.println(map);
        return "success";
    }
}
